package com.situ.team5.kzq.power.dao;

import com.situ.team5.pojo.ConfigMajor;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.RequestMapping;

@Mapper
public interface JsDAO {
//添加角色
    @Insert("<script>" +
            "\tinsert into config_major\n" +
            " ("+
            "\t\t\t<if test=\"major_name != null\">major_name,</if>\n" +
            "\t\t\t<if test=\"major_kind_id != null\">major_kind_id,</if>\n" +
            "\t\t\t<if test=\"test_amount != null\">test_amount,</if>\n" +
            "\t\t\t<if test=\"xq != null\" >xq,</if>\n" +
            "\t\t\t<if test=\"status != null\" >status</if>\n" +
            "\n) " +
            "values("+
            "\t\t\t<if test=\"major_name != null\">#{major_name},</if>\n" +
            "\t\t\t<if test=\"major_kind_id != null\">#{major_kind_id},</if>\n" +
            "\t\t\t<if test=\"test_amount != null\">#{test_amount},</if>\n" +
            "\t\t\t<if test=\"xq != null\" >#{xq},</if>\n" +
            "\t\t\t<if test=\"status != null\" >#{status}</if>" +
            " )"+
            "</script>")
    void right_add2_Insert(ConfigMajor c);
//通过id查询角色信息
   @Select("select * from config_major where major_id=#{value}")
    ConfigMajor right_listSelectone(int id);
//职位删除
    @Update("delete from config_major where major_id=#{value}")
    void right_list_delete(int id);
//修改
    @Update("update config_major set major_name=#{major_name}," +
            "major_kind_id=#{major_kind_id},test_amount=#{test_amount}," +
            "xq=#{xq},status=#{status} where major_id=#{major_id} ")
    void right_list_update2(ConfigMajor c);
}
